package cn.com.note.view;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import cn.com.note.R;

/**
 * Created by SunFuLin on 2019/1/11.
 */

public class MenuSend extends LinearLayout{
    Context context;
    ImageView ivImage;
    TextView tvName;
    public MenuSend(Context context) {
        super(context,null);

    }

    public MenuSend(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        this.context=context;
        init();
    }

    private void init() {
        LayoutInflater.from(context).inflate(R.layout.layout_menu_send, this);
        ivImage = (ImageView) findViewById(R.id.iv_img);
        tvName = (TextView) findViewById(R.id.tv_name);
    }
    public void updateUi(Drawable drawable,String str){
        updateIcon(drawable);
        updateTitle(str);
    }
    public void updateIcon(Drawable drawable){
        ivImage.setImageDrawable(drawable);
    }

    public void updateTitle(String t){
        tvName.setText(t);
    }
}
